import {baseUrl} from "../config/index"

export  const $instance = (parmas={})=>{
  const token = wx.getStorageSync('token')
  return new Promise(function(resolve,reject){
    wx.showLoading({
      title: '加载中',
    })
    wx.request({
      url: baseUrl+parmas.url,
      data:{},
      header:{
        token:token
      },
      success(res){
        console.log("返回的数据",res.data);
        resolve(res.data)
      },
      fail(err){
        console.log("请求失败");
        reject(err)
      },
    complete(){
        console.log("请求结束");
        wx.hideLoading({
          success:(res) =>{},
        })
    },
    })
  })

}


